package cn.zjweu.service.impl;

import cn.zjweu.dao.CartDao;
import cn.zjweu.dao.impl.CartDaoImpl;
import cn.zjweu.domain.Dish;
import cn.zjweu.domain.UserCart;
import cn.zjweu.service.CartService;

import java.util.List;

public class CartServiceImpl implements CartService {

    private CartDao cartDao = new CartDaoImpl();

    @Override
    public UserCart findCartByUserAndDish(int userId, int dishId) {
        return cartDao.findCartByUserAndDish(userId, dishId);
    }

    @Override
    public boolean editCountInCart(UserCart userCart) {
        return cartDao.editCountInCart(userCart);
    }

    @Override
    public boolean saveToCart(UserCart userCart) {
        return cartDao.saveToCart(userCart);
    }

    @Override
    public boolean clearCartByUserIdOrDishId(int userId, int dishId) {
        return cartDao.clearCartByUserIdOrDishId(userId, dishId);
    }

    @Override
    public List<Dish> findCartListByUserId(int userId) {
        return cartDao.findCartListByUserId(userId);
    }

    @Override
    public boolean clearCartByUserId(int userId) {
        return cartDao.clearCartByUserId(userId);
    }
}
